home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / libpurple / debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  5.3 KB  |  199 lines

  1. /**
  2.  * @file debug.h Debug API
  3.  * @ingroup core
  4.  *
  5.  * purple
  6.  *
  7.  * Purple is the legal property of its developers, whose names are too numerous
  8.  * to list here.  Please refer to the COPYRIGHT file distributed with this
  9.  * source distribution.
  10.  *
  11.  * This program is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  24.  */
  25. #ifndef _PURPLE_DEBUG_H_
  26. #define _PURPLE_DEBUG_H_
  27.  
  28. #include <glib.h>
  29. #include <stdarg.h>
  30.  
  31. /**
  32.  * Debug levels.
  33.  */
  34. typedef enum
  35. {
  36.     PURPLE_DEBUG_ALL = 0,  /**< All debug levels.              */
  37.     PURPLE_DEBUG_MISC,     /**< General chatter.               */
  38.     PURPLE_DEBUG_INFO,     /**< General operation Information. */
  39.     PURPLE_DEBUG_WARNING,  /**< Warnings.                      */
  40.     PURPLE_DEBUG_ERROR,    /**< Errors.                        */
  41.     PURPLE_DEBUG_FATAL     /**< Fatal errors.                  */
  42.  
  43. } PurpleDebugLevel;
  44.  
  45. /**
  46.  * Debug UI operations.
  47.  */
  48. typedef struct
  49. {
  50.     void (*print)(PurpleDebugLevel level, const char *category,
  51.                   const char *arg_s);
  52.     gboolean (*is_enabled)(PurpleDebugLevel level,
  53.             const char *category);
  54.  
  55.     void (*_purple_reserved1)(void);
  56.     void (*_purple_reserved2)(void);
  57.     void (*_purple_reserved3)(void);
  58.     void (*_purple_reserved4)(void);
  59. } PurpleDebugUiOps;
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65. /**************************************************************************/
  66. /** @name Debug API                                                       */
  67. /**************************************************************************/
  68. /**
  69.  * Outputs debug information.
  70.  *
  71.  * @param level    The debug level.
  72.  * @param category The category (or @c NULL).
  73.  * @param format   The format string.
  74.  */
  75. void purple_debug(PurpleDebugLevel level, const char *category,
  76.                 const char *format, ...);
  77.  
  78. /**
  79.  * Outputs misc. level debug information.
  80.  *
  81.  * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_MISC as
  82.  * the level.
  83.  *
  84.  * @param category The category (or @c NULL).
  85.  * @param format   The format string.
  86.  *
  87.  * @see purple_debug()
  88.  */
  89. void purple_debug_misc(const char *category, const char *format, ...);
  90.  
  91. /**
  92.  * Outputs info level debug information.
  93.  *
  94.  * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_INFO as
  95.  * the level.
  96.  *
  97.  * @param category The category (or @c NULL).
  98.  * @param format   The format string.
  99.  *
  100.  * @see purple_debug()
  101.  */
  102. void purple_debug_info(const char *category, const char *format, ...);
  103.  
  104. /**
  105.  * Outputs warning level debug information.
  106.  *
  107.  * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_WARNING as
  108.  * the level.
  109.  *
  110.  * @param category The category (or @c NULL).
  111.  * @param format   The format string.
  112.  *
  113.  * @see purple_debug()
  114.  */
  115. void purple_debug_warning(const char *category, const char *format, ...);
  116.  
  117. /**
  118.  * Outputs error level debug information.
  119.  *
  120.  * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
  121.  * the level.
  122.  *
  123.  * @param category The category (or @c NULL).
  124.  * @param format   The format string.
  125.  *
  126.  * @see purple_debug()
  127.  */
  128. void purple_debug_error(const char *category, const char *format, ...);
  129.  
  130. /**
  131.  * Outputs fatal error level debug information.
  132.  *
  133.  * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
  134.  * the level.
  135.  *
  136.  * @param category The category (or @c NULL).
  137.  * @param format   The format string.
  138.  *
  139.  * @see purple_debug()
  140.  */
  141. void purple_debug_fatal(const char *category, const char *format, ...);
  142.  
  143. /**
  144.  * Enable or disable printing debug output to the console.
  145.  *
  146.  * @param enabled TRUE to enable debug output or FALSE to disable it.
  147.  */
  148. void purple_debug_set_enabled(gboolean enabled);
  149.  
  150. /**
  151.  * Check if console debug output is enabled.
  152.  *
  153.  * @return TRUE if debuggin is enabled, FALSE if it is not.
  154.  */
  155. gboolean purple_debug_is_enabled(void);
  156.  
  157. /*@}*/
  158.  
  159. /**************************************************************************/
  160. /** @name UI Registration Functions                                       */
  161. /**************************************************************************/
  162. /*@{*/
  163.  
  164. /**
  165.  * Sets the UI operations structure to be used when outputting debug
  166.  * information.
  167.  *
  168.  * @param ops The UI operations structure.
  169.  */
  170. void purple_debug_set_ui_ops(PurpleDebugUiOps *ops);
  171.  
  172. /**
  173.  * Returns the UI operations structure used when outputting debug
  174.  * information.
  175.  *
  176.  * @return The UI operations structure in use.
  177.  */
  178. PurpleDebugUiOps *purple_debug_get_ui_ops(void);
  179.  
  180. /*@}*/
  181.  
  182. /**************************************************************************/
  183. /** @name Debug Subsystem                                                 */
  184. /**************************************************************************/
  185. /*@{*/
  186.  
  187. /**
  188.  * Initializes the debug subsystem.
  189.  */
  190. void purple_debug_init(void);
  191.  
  192. /*@}*/
  193.  
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197.  
  198. #endif /* _PURPLE_DEBUG_H_ */
  199.